home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / batchlrn.arc / SHIFT.HLP < prev    next >
Text File  |  1991-06-17  |  5KB  |  67 lines

  1. |---------------B A T C H L R N  H E L P  S Y S T E M-----------------|
  2. |command: SHIFT                                                       |
  3. |use: The SHIFT command lets your batch file access more than 10      |
  4. | replaceable parameters.                                             |
  5. |                                      |
  6. |example:The SHIFT command is illustrated by this example:            |
  7. |     [the lines below are as they would appear in a batch file]      |
  8. |     If %0 = "bak"                                                   |
  9. |     %1 = "mine"                                                     |
  10. |     %2 = "yours"                                                    |
  11. |     %3...%9 are empty                                               |
  12. |     then a SHIFT (command) results in the following:                |
  13. |     %0 = "bak"                                                      |
  14. |     %1 = "yours"                                                    |
  15. |     %2...%9 are empty  ["mine" has been "shifted" out]              |
  16. | If you are still confused review the PARAM.HLP file.                |
  17. |                                                                     |
  18. |NOTES:DOS allows 10 parameters (%0-%9) to be used by a batch file.   |
  19. | SHIFT allows you to move more parameters into a queue, discarding   |
  20. | the first parameter. When you are listing parameters at the prompt, |
  21. | additional parameters (more than 10) should be on the same command  |
  22. | line in order to be shifted into the queue.The single cmd.is SHIFT. |
  23. | When that subcommand is encountered, all parameter/marker pairings  |
  24. | are shifted one to the left. Whatever was assigned to %0 is lost,   |
  25. | the contents of %1 are moved to %0, %2 moves to %1... %9 moves to   |
  26. | %8 and a new parameter from the command line is moved into %9.      |
  27. | While this brings in a new parameter, all have shifted and you must |
  28. | anticipate the effect on your batch file "program".                 |
  29. | The effect of SHIFT:                                                |
  30. |  %0   %1   %2   %3   %4   %5   %6   %7   %8   %9                    |
  31. |  |      Remember, this command seems very simple, but its effects   |
  32. |  |      are far ranging and the logical consequence of mis-matching |
  33. |  |      parameters and markers can be disastrous!                   |
  34. |  |                                                                  |
  35. | Lost                                                                |
  36. |                                                                     |
  37. |                 MORE ABOUT THE SHIFT SUBCOMMAND:                    |
  38. | The SHIFT subcommand is made to be used with replaceable parameters.|
  39. | In the PARAM.HLP file there is an example for you to create called  |
  40. | SEEFILE.BAT which shows you how to display three files you call up. |
  41. | What if you wanted to display four files? You would have to rewrite |
  42. | the batch file to include another TYPE command, or you could use    |
  43. | the SHIFT command for more than 10 parameters in a file. The        |
  44. | following batch file uses the GOTO and SHIFT command to ECHO any    |
  45. | number of parameters typed on the command line.                     |
  46. |                    (you should create this file)                    |
  47. |       COPY CON:REVEAL.BAT                                           |
  48. |       ECHO OFF                                                      |
  49. |       CLS                                  |
  50. |       :LOOP                                                         |
  51. |       CLS                                                           |
  52. |       TYPE %1 | MORE                                                |
  53. |       SHIFT                                                         |
  54. |       GOTO LOOP                                                     |
  55. |       <F6> or <Ctrl Z> <Return>                                     |
  56. | To execute type: REVEAL <FILENAME.EXT> <FILENAME.EXT>,ETC.,ETC.     |
  57. |                                      |
  58. | CAUTION:When this file runs out of parameters you will get a message|
  59. | "invalid number of parameters". It will then KEEP REPEATING until   |
  60. | YOU STOP IT with a Ctrl C or Ctrl-Break! The file can only "read"   |
  61. | the number of parameters you put on the prompt or command line.     |
  62. | NOTE: the MORE command is to assure that if a text file (that is    |
  63. | the only kind you can display with TYPE) is more than 24 lines, a   |
  64. | pause will be inserted. Wildcards cannot be used with the command.  |
  65. |                                      |
  66. |----------------- T  I  M  E  M  A  S  T  E  R  ---------------------|
  67.